package day04;


import java.util.*;

public class Demo02 {
    public static void main(String[] args) {
        /*
         * 限制了 Card 的参数类型只能是 Suit 约束的类型
         */
        Card card = new Card(Suit.DIAMOND, Rank.ACE);
        /*
         * 枚举的遍历
         * Rank.values() 返回所有枚举元素，枚举值的遍历
         */
        for (Rank rank: Rank.values()){
            System.out.println(rank);
        }
        List<Card> cards = new ArrayList<>();
        int index = 0;
        for (Rank rank: Rank.values()){
            //跳过大小王
            if (rank == Rank.BLACK || rank == Rank.RED){
                continue;
            }
            cards.add(new Card(Suit.DIAMOND,rank));
            cards.add(new Card(Suit.CLUB,rank));
            cards.add(new Card(Suit.HEART,rank));
            cards.add(new Card(Suit.SPADE,rank));
        }
        cards.add(new Card(Suit.JOKER, Rank.BLACK));
        cards.add(new Card(Suit.JOKER, Rank.RED));
        System.out.println(cards);
        Collections.shuffle(cards);
        System.out.println(cards);
        Collections.sort(cards, Comparator.comparing(Card::getRank));
        System.out.println(cards);
    }
}
